import { Component, Input } from '@angular/core';
import { NavParams, ModalController } from '@ionic/angular';
import {VgAPI} from 'videogular2/core';

@Component({
    selector: 'alarm-video',
    templateUrl: './alarm-video.html',
    styleUrls: ['alarm-video.scss']
})
export class VideoModal {

    @Input() config;
    api: VgAPI;

    constructor(params: NavParams, public modalCtrl: ModalController) {
        console.log('config', params.get('config'));
        this.config = params.get('config');
    }

    onPlayerReady(api: VgAPI) {
        this.api = api;
        this.api.getDefaultMedia().play();
    }

    closeModal() {
        this.modalCtrl.dismiss();
    }

}
